github.com/pbberlin/tools@v0.0.0-20160910141205-7aa5421c2169/dsu/ancestored_urls/http handlers.go (about)

     1  package ancestored_urls
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/pbberlin/tools/net/http/loghttp"
     7  	"github.com/pbberlin/tools/net/http/tplx"
     8  )
     9  
    10  func init() {
    11  	http.HandleFunc("/save-url/save-no-anc", loghttp.Adapter(saveURLNoAnc))
    12  	http.HandleFunc("/save-url/save-wi-anc", loghttp.Adapter(saveURLWithAncestor))
    13  	http.HandleFunc("/save-url/view-no-anc", loghttp.Adapter(listURLNoAnc))
    14  	http.HandleFunc("/save-url/view-wi-anc", loghttp.Adapter(listURLWithAncestors))
    15  	http.HandleFunc("/save-url/backend", loghttp.Adapter(backend))
    16  	http.HandleFunc("/save-url/", loghttp.Adapter(backend))
    17  
    18  }
    19  
    20  func backend(w http.ResponseWriter, r *http.Request, m map[string]interface{}) {
    21  
    22  	add, tplExec := tplx.FuncTplBuilder(w, r)
    23  
    24  	add("n_html_title", "Saving an URL into the datastore", "")
    25  	//add("n_cont_0", tplx.PrefixLff+"body_dsu_ancestored_urls", "")
    26  	add("n_cont_0", tplx.PrefixLff+"body_last_url", "")
    27  
    28  	tplExec(w, r)
    29  
    30  }